created backend for saving breaks to calendar (only calendar break files added, unnecessary changes reverted) #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I created a controller, CalendarBreakController.java, that contains API endpoints to receive requests from frontend (calendar.md) regarding the creating, displaying, editing, and deleting of breaks. I also created three files, CalendarBreak.java, CalendarBreakRepository.java, and CalendarBreakService.java, which create the database for saving breaks from frontend.
API Endpoints Created/Enhanced:
1. POST /api/calendar/breaks/create (FIXED & ENHANCED)
2. PUT /api/calendar/breaks/{id} (NEW)
3. DELETE /api/calendar/breaks/{id} (ENHANCED)
4. GET /api/calendar/breaks/ (VERIFIED)
5. GET /api/calendar/breaks/by-date (VERIFIED)
6. GET /api/calendar/breaks/is-break-day (VERIFIED)
7. GET /api/calendar/breaks/{id} (VERIFIED)
Key Technical Changes:
CalendarBreak.java - Updated entity with [name] fields
CalendarBreakService.java - Enhanced with: findNextNonBreakDay() method for calculating next available date
, and [updateBreak()] method for editing breaks
CalendarBreakController.java - Completely redesigned with new base path [/api/calendar/breaks] to avoid conflicts
, proper input validation
, comprehensive error handling
, all 7 endpoints with clean architecture
Database Schema - Updated calendar_breaks table with [name] columns
Testing Results:
All endpoints have been tested and verified working:
✓ Create breaks with custom names and descriptions
✓ Edit breaks
✓ Delete breaks
✓ Retrieve all breaks
✓ Retrieve breaks by date
✓ Check if date is a break day
✓ Proper error handling with appropriate HTTP status codes